package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Pingtaitongzhi;
import com.ruoyi.system.service.IPingtaitongzhiService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 平台通知Controller
 * 
 * @author cjq
 * @date 2024-08-10
 */
@RestController
@RequestMapping("/system/pingtaitongzhi")
public class PingtaitongzhiController extends BaseController
{
    @Autowired
    private IPingtaitongzhiService pingtaitongzhiService;


    /**
     * 查询平台通知列表
     */
    @PreAuthorize("@ss.hasPermi('system:pingtaitongzhi:list')")
    @GetMapping("/list")
    public TableDataInfo list(Pingtaitongzhi pingtaitongzhi)
    {
        startPage();
        List<Pingtaitongzhi> list = pingtaitongzhiService.selectPingtaitongzhiList(pingtaitongzhi);
        return getDataTable(list);
    }

    /**
     * 导出平台通知列表
     */
    @PreAuthorize("@ss.hasPermi('system:pingtaitongzhi:export')")
    @Log(title = "平台通知", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Pingtaitongzhi pingtaitongzhi)
    {
        List<Pingtaitongzhi> list = pingtaitongzhiService.selectPingtaitongzhiList(pingtaitongzhi);
        ExcelUtil<Pingtaitongzhi> util = new ExcelUtil<Pingtaitongzhi>(Pingtaitongzhi.class);
        util.exportExcel(response, list, "平台通知数据");
    }

    /**
     * 获取平台通知详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:pingtaitongzhi:query')")
    @GetMapping(value = "/{pttzId}")
    public AjaxResult getInfo(@PathVariable("pttzId") Long pttzId)
    {
        return success(pingtaitongzhiService.selectPingtaitongzhiByPttzId(pttzId));
    }

    /**
     * 新增平台通知
     */
    @PreAuthorize("@ss.hasPermi('system:pingtaitongzhi:add')")
    @Log(title = "平台通知", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Pingtaitongzhi pingtaitongzhi)
    {
        return toAjax(pingtaitongzhiService.insertPingtaitongzhi(pingtaitongzhi));
    }

    /**
     * 修改平台通知
     */
    @PreAuthorize("@ss.hasPermi('system:pingtaitongzhi:edit')")
    @Log(title = "平台通知", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Pingtaitongzhi pingtaitongzhi)
    {
        return toAjax(pingtaitongzhiService.updatePingtaitongzhi(pingtaitongzhi));
    }

    /**
     * 删除平台通知
     */
    @PreAuthorize("@ss.hasPermi('system:pingtaitongzhi:remove')")
    @Log(title = "平台通知", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pttzIds}")
    public AjaxResult remove(@PathVariable Long[] pttzIds)
    {
        return toAjax(pingtaitongzhiService.deletePingtaitongzhiByPttzIds(pttzIds));
    }
}
